home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dblookup.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  13.5 KB  |  340 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'DBLookup.pas' rev: 3.00
  6.  
  7. #ifndef DBLookupHPP
  8. #define DBLookupHPP
  9. #include <DBCtrls.hpp>
  10. #include <Grids.hpp>
  11. #include <DBTables.hpp>
  12. #include <DBGrids.hpp>
  13. #include <Buttons.hpp>
  14. #include <Menus.hpp>
  15. #include <Graphics.hpp>
  16. #include <Forms.hpp>
  17. #include <SysUtils.hpp>
  18. #include <Messages.hpp>
  19. #include <Controls.hpp>
  20. #include <Db.hpp>
  21. #include <StdCtrls.hpp>
  22. #include <Classes.hpp>
  23. #include <Windows.hpp>
  24. #include <SysInit.hpp>
  25. #include <System.hpp>
  26.  
  27. //-- user supplied -----------------------------------------------------------
  28.  
  29. namespace Dblookup
  30. {
  31. //-- type declarations -------------------------------------------------------
  32. enum TDBLookupComboStyle { csDropDown, csDropDownList };
  33.  
  34. enum TDBLookupListOption { loColLines, loRowLines, loTitles };
  35.  
  36. typedef Set<TDBLookupListOption, loColLines, loTitles>  TDBLookupListOptions;
  37.  
  38. class DELPHICLASS TDBLookupCombo;
  39. class DELPHICLASS TPopupGrid;
  40. class DELPHICLASS TDBLookupList;
  41. class PASCALIMPLEMENTATION TDBLookupList : public Dbgrids::TCustomDBGrid 
  42. {
  43.     typedef Dbgrids::TCustomDBGrid inherited;
  44.     
  45. private:
  46.     Dbctrls::TFieldDataLink* FFieldLink;
  47.     System::AnsiString FLookupDisplay;
  48.     System::AnsiString FLookupField;
  49.     Db::TField* FDisplayFld;
  50.     Db::TField* FValueFld;
  51.     System::AnsiString FValue;
  52.     System::AnsiString FDisplayValue;
  53.     int FHiliteRow;
  54.     TDBLookupListOptions FOptions;
  55.     int FTitleOffset;
  56.     bool FFoundValue;
  57.     bool FInCellSelect;
  58.     Classes::TNotifyEvent FOnListClick;
  59.     System::AnsiString __fastcall GetDataField(void);
  60.     HIDESBASE Db::TDataSource* __fastcall GetDataSource(void);
  61.     Db::TDataSource* __fastcall GetLookupSource(void);
  62.     bool __fastcall GetReadOnly(void);
  63.     void __fastcall FieldLinkActive(System::TObject* Sender);
  64.     void __fastcall DataChange(System::TObject* Sender);
  65.     void __fastcall SetDataField(const System::AnsiString Value);
  66.     HIDESBASE void __fastcall SetDataSource(Db::TDataSource* Value);
  67.     void __fastcall SetLookupSource(Db::TDataSource* Value);
  68.     void __fastcall SetLookupDisplay(const System::AnsiString Value);
  69.     void __fastcall SetLookupField(const System::AnsiString Value);
  70.     void __fastcall SetValue(const System::AnsiString Value);
  71.     void __fastcall SetDisplayValue(const System::AnsiString Value);
  72.     void __fastcall SetReadOnly(bool Value);
  73.     HIDESBASE void __fastcall SetOptions(TDBLookupListOptions Value);
  74.     HIDESBASE void __fastcall UpdateData(System::TObject* Sender);
  75.     void __fastcall NewLayout(void);
  76.     void __fastcall DoLookup(void);
  77.     HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  78.     HIDESBASE MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message);
  79.     HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message);
  80.     
  81. protected:
  82.     virtual bool __fastcall HighlightCell(int DataCol, int DataRow, const System::AnsiString Value, Grids::TGridDrawState 
  83.         AState);
  84.     DYNAMIC bool __fastcall CanGridAcceptKey(Word Key, Classes::TShiftState Shift);
  85.     virtual void __fastcall DefineFieldMap(void);
  86.     virtual void __fastcall SetColumnAttributes(void);
  87.     DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
  88.         int Y);
  89.     DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
  90.     DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int 
  91.         Y);
  92.     virtual bool __fastcall CanEdit(void);
  93.     void __fastcall InitFields(bool ShowError);
  94.     virtual void __fastcall CreateWnd(void);
  95.     DYNAMIC void __fastcall KeyDown(Word &Key, Classes::TShiftState Shift);
  96.     DYNAMIC void __fastcall KeyPress(char &Key);
  97.     virtual void __fastcall LinkActive(bool Value);
  98.     virtual void __fastcall Paint(void);
  99.     virtual void __fastcall Scroll(int Distance);
  100.     DYNAMIC void __fastcall ListClick(void);
  101.     virtual void __fastcall Loaded(void);
  102.     virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation
  103.         );
  104.     
  105. public:
  106.     __fastcall virtual TDBLookupList(Classes::TComponent* AOwner);
  107.     __fastcall virtual ~TDBLookupList(void);
  108.     __property System::AnsiString Value = {read=FValue, write=SetValue};
  109.     __property System::AnsiString DisplayValue = {read=FDisplayValue, write=SetDisplayValue};
  110.     
  111. __published:
  112.     __property System::AnsiString DataField = {read=GetDataField, write=SetDataField};
  113.     __property Db::TDataSource* DataSource = {read=GetDataSource, write=SetDataSource};
  114.     __property Db::TDataSource* LookupSource = {read=GetLookupSource, write=SetLookupSource};
  115.     __property System::AnsiString LookupDisplay = {read=FLookupDisplay, write=SetLookupDisplay};
  116.     __property System::AnsiString LookupField = {read=FLookupField, write=SetLookupField};
  117.     __property TDBLookupListOptions Options = {read=FOptions, write=SetOptions, default=0};
  118.     __property Classes::TNotifyEvent OnClick = {read=FOnListClick, write=FOnListClick};
  119.     __property bool ReadOnly = {read=GetReadOnly, write=SetReadOnly, default=0};
  120.     __property Align ;
  121.     __property BorderStyle ;
  122.     __property Color ;
  123.     __property Ctl3D ;
  124.     __property DragCursor ;
  125.     __property DragMode ;
  126.     __property Enabled ;
  127.     __property Font ;
  128.     __property ImeMode ;
  129.     __property ImeName ;
  130.     __property ParentColor ;
  131.     __property ParentCtl3D ;
  132.     __property ParentFont ;
  133.     __property ParentShowHint ;
  134.     __property PopupMenu ;
  135.     __property ShowHint ;
  136.     __property TabOrder ;
  137.     __property TabStop ;
  138.     __property Visible ;
  139.     __property OnDblClick ;
  140.     __property OnDragDrop ;
  141.     __property OnDragOver ;
  142.     __property OnEndDrag ;
  143.     __property OnEnter ;
  144.     __property OnExit ;
  145.     __property OnKeyDown ;
  146.     __property OnKeyPress ;
  147.     __property OnKeyUp ;
  148.     __property OnStartDrag ;
  149. public:
  150.     /* TWinControl.CreateParented */ __fastcall TDBLookupList(HWND ParentWindow) : Dbgrids::TCustomDBGrid(
  151.         ParentWindow) { }
  152.     
  153. };
  154.  
  155. class PASCALIMPLEMENTATION TPopupGrid : public Dblookup::TDBLookupList 
  156. {
  157.     typedef Dblookup::TDBLookupList inherited;
  158.     
  159. private:
  160.     TDBLookupCombo* FCombo;
  161.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &Message);
  162.     
  163. protected:
  164.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  165.     virtual void __fastcall CreateWnd(void);
  166.     HIDESBASE MESSAGE void __fastcall WMLButtonUp(Messages::TWMMouse &Message);
  167.     DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
  168.         int Y);
  169.     virtual bool __fastcall CanEdit(void);
  170.     virtual void __fastcall LinkActive(bool Value);
  171.     
  172. public:
  173.     __property RowCount ;
  174.     __fastcall virtual TPopupGrid(Classes::TComponent* AOwner);
  175. public:
  176.     /* TDBLookupList.Destroy */ __fastcall virtual ~TPopupGrid(void) { }
  177.     
  178. public:
  179.     /* TWinControl.CreateParented */ __fastcall TPopupGrid(HWND ParentWindow) : Dblookup::TDBLookupList(
  180.         ParentWindow) { }
  181.     
  182. };
  183.  
  184. class PASCALIMPLEMENTATION TDBLookupCombo : public Stdctrls::TCustomEdit 
  185. {
  186.     typedef Stdctrls::TCustomEdit inherited;
  187.     
  188. private:
  189.     Controls::TControlCanvas* FCanvas;
  190.     int FDropDownCount;
  191.     int FDropDownWidth;
  192.     int FTextMargin;
  193.     Dbctrls::TFieldDataLink* FFieldLink;
  194.     TPopupGrid* FGrid;
  195.     Buttons::TSpeedButton* FButton;
  196.     Controls::TWinControl* FBtnControl;
  197.     TDBLookupComboStyle FStyle;
  198.     Classes::TNotifyEvent FOnDropDown;
  199.     System::AnsiString __fastcall GetDataField(void);
  200.     Db::TDataSource* __fastcall GetDataSource(void);
  201.     Db::TDataSource* __fastcall GetLookupSource(void);
  202.     System::AnsiString __fastcall GetLookupDisplay(void);
  203.     System::AnsiString __fastcall GetLookupField(void);
  204.     bool __fastcall GetReadOnly(void);
  205.     System::AnsiString __fastcall GetValue(void);
  206.     System::AnsiString __fastcall GetDisplayValue(void);
  207.     int __fastcall GetMinHeight(void);
  208.     TDBLookupListOptions __fastcall GetOptions(void);
  209.     bool __fastcall CanEdit(void);
  210.     bool __fastcall Editable(void);
  211.     void __fastcall SetValue(const System::AnsiString NewValue);
  212.     void __fastcall SetDisplayValue(const System::AnsiString NewValue);
  213.     void __fastcall DataChange(System::TObject* Sender);
  214.     void __fastcall EditingChange(System::TObject* Sender);
  215.     void __fastcall SetDataField(const System::AnsiString Value);
  216.     void __fastcall SetDataSource(Db::TDataSource* Value);
  217.     void __fastcall SetLookupSource(Db::TDataSource* Value);
  218.     void __fastcall SetLookupDisplay(const System::AnsiString Value);
  219.     void __fastcall SetLookupField(const System::AnsiString Value);
  220.     HIDESBASE void __fastcall SetReadOnly(bool Value);
  221.     void __fastcall SetOptions(TDBLookupListOptions Value);
  222.     void __fastcall SetStyle(TDBLookupComboStyle Value);
  223.     void __fastcall UpdateData(System::TObject* Sender);
  224.     void __fastcall FieldLinkActive(System::TObject* Sender);
  225.     void __fastcall NonEditMouseDown(Messages::TWMMouse &Message);
  226.     void __fastcall DoSelectAll(void);
  227.     void __fastcall SetEditRect(void);
  228.     MESSAGE void __fastcall WMPaste(Messages::TMessage &Message);
  229.     MESSAGE void __fastcall WMCut(Messages::TMessage &Message);
  230.     HIDESBASE MESSAGE void __fastcall WMKillFocus(Messages::TWMKillFocus &Message);
  231.     HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  232.     MESSAGE void __fastcall CMCancelMode(Controls::TCMCancelMode &Message);
  233.     HIDESBASE MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message);
  234.     HIDESBASE MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &Message);
  235.     HIDESBASE MESSAGE void __fastcall WMLButtonDblClk(Messages::TWMMouse &Message);
  236.     HIDESBASE MESSAGE void __fastcall WMLButtonUp(Messages::TWMMouse &Message);
  237.     HIDESBASE MESSAGE void __fastcall WMSetFocus(Messages::TWMSetFocus &Message);
  238.     HIDESBASE MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message);
  239.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &Message);
  240.     HIDESBASE MESSAGE void __fastcall WMPaint(Messages::TWMPaint &Message);
  241.     HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
  242.     HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message);
  243.     
  244. protected:
  245.     virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation
  246.         );
  247.     DYNAMIC void __fastcall Change(void);
  248.     DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
  249.     DYNAMIC void __fastcall KeyDown(Word &Key, Classes::TShiftState Shift);
  250.     DYNAMIC void __fastcall KeyPress(char &Key);
  251.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  252.     virtual void __fastcall CreateWnd(void);
  253.     void __fastcall GridClick(System::TObject* Sender);
  254.     virtual void __fastcall Loaded(void);
  255.     
  256. public:
  257.     __fastcall virtual TDBLookupCombo(Classes::TComponent* AOwner);
  258.     __fastcall virtual ~TDBLookupCombo(void);
  259.     DYNAMIC void __fastcall DropDown(void);
  260.     DYNAMIC void __fastcall CloseUp(void);
  261.     __property System::AnsiString Value = {read=GetValue, write=SetValue};
  262.     __property System::AnsiString DisplayValue = {read=GetDisplayValue, write=SetDisplayValue};
  263.     
  264. __published:
  265.     __property System::AnsiString DataField = {read=GetDataField, write=SetDataField};
  266.     __property Db::TDataSource* DataSource = {read=GetDataSource, write=SetDataSource};
  267.     __property Db::TDataSource* LookupSource = {read=GetLookupSource, write=SetLookupSource};
  268.     __property System::AnsiString LookupDisplay = {read=GetLookupDisplay, write=SetLookupDisplay};
  269.     __property System::AnsiString LookupField = {read=GetLookupField, write=SetLookupField};
  270.     __property TDBLookupListOptions Options = {read=GetOptions, write=SetOptions, default=0};
  271.     __property TDBLookupComboStyle Style = {read=FStyle, write=SetStyle, default=0};
  272.     __property AutoSelect ;
  273.     __property Color ;
  274.     __property Ctl3D ;
  275.     __property DragCursor ;
  276.     __property DragMode ;
  277.     __property int DropDownCount = {read=FDropDownCount, write=FDropDownCount, default=8};
  278.     __property int DropDownWidth = {read=FDropDownWidth, write=FDropDownWidth, default=0};
  279.     __property Enabled ;
  280.     __property Font ;
  281.     __property ImeMode ;
  282.     __property ImeName ;
  283.     __property MaxLength ;
  284.     __property ParentColor ;
  285.     __property ParentCtl3D ;
  286.     __property ParentFont ;
  287.     __property ParentShowHint ;
  288.     __property PopupMenu ;
  289.     __property bool ReadOnly = {read=GetReadOnly, write=SetReadOnly, default=0};
  290.     __property ShowHint ;
  291.     __property TabOrder ;
  292.     __property TabStop ;
  293.     __property Visible ;
  294.     __property OnChange ;
  295.     __property OnClick ;
  296.     __property OnDblClick ;
  297.     __property OnDragDrop ;
  298.     __property OnDragOver ;
  299.     __property Classes::TNotifyEvent OnDropDown = {read=FOnDropDown, write=FOnDropDown};
  300.     __property OnEndDrag ;
  301.     __property OnEnter ;
  302.     __property OnExit ;
  303.     __property OnKeyDown ;
  304.     __property OnKeyPress ;
  305.     __property OnKeyUp ;
  306.     __property OnMouseDown ;
  307.     __property OnMouseMove ;
  308.     __property OnMouseUp ;
  309.     __property OnStartDrag ;
  310. public:
  311.     /* TWinControl.CreateParented */ __fastcall TDBLookupCombo(HWND ParentWindow) : Stdctrls::TCustomEdit(
  312.         ParentWindow) { }
  313.     
  314. };
  315.  
  316. class DELPHICLASS TComboButton;
  317. class PASCALIMPLEMENTATION TComboButton : public Buttons::TSpeedButton 
  318. {
  319.     typedef Buttons::TSpeedButton inherited;
  320.     
  321. protected:
  322.     DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
  323.     DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
  324.         int Y);
  325. public:
  326.     /* TSpeedButton.Create */ __fastcall virtual TComboButton(Classes::TComponent* AOwner) : Buttons::TSpeedButton(
  327.         AOwner) { }
  328.     /* TSpeedButton.Destroy */ __fastcall virtual ~TComboButton(void) { }
  329.     
  330. };
  331.  
  332. //-- var, const, procedure ---------------------------------------------------
  333.  
  334. }    /* namespace Dblookup */
  335. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  336. using namespace Dblookup;
  337. #endif
  338. //-- end unit ----------------------------------------------------------------
  339. #endif    // DBLookup
  340.